package GUI;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.border.EmptyBorder;
import javax.swing.table.TableColumn;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;



import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.util.Vector;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JLabel;
import java.awt.Font;

public class SelectReport extends JFrame {
	//Attributes
    private String fireplaceQuery = "Select Fireplace_ID, Fireplace_Name, Description, Finish, Style, Item_price, Stock_quantity, Supplier_name from fireplace, supplier where fireplace.supplier_id = supplier.supplier_id";
	private String supplierQuery = "Select * from supplier";
	private String fireplaceTitle = "Fireplace Report";
    private String supplierTitle ="Supplier Report";
	private JPanel contentPane;

    public SelectReport() {
               
        JFrame frmSelectReportType = new JFrame("Fireplace Report");
        frmSelectReportType.setTitle("Select Report Type");
        setVisible(true);
        frmSelectReportType.setSize(525, 318); //setting frame size
        
        JPanel panel = new JPanel();
        
        JPanel panel_1 = new JPanel();
        
        JButton button_2 = new JButton("Exit");
        button_2.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
        		
        		System.exit(0);
        	}
        });
        GroupLayout groupLayout = new GroupLayout(frmSelectReportType.getContentPane());
        groupLayout.setHorizontalGroup(
        	groupLayout.createParallelGroup(Alignment.LEADING)
        		.addGroup(groupLayout.createSequentialGroup()
        			.addGap(28)
        			.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
        				.addComponent(panel_1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        				.addComponent(panel, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 453, GroupLayout.PREFERRED_SIZE))
        			.addContainerGap(28, Short.MAX_VALUE))
        		.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
        			.addContainerGap(381, Short.MAX_VALUE)
        			.addComponent(button_2, GroupLayout.PREFERRED_SIZE, 82, GroupLayout.PREFERRED_SIZE)
        			.addGap(46))
        );
        groupLayout.setVerticalGroup(
        	groupLayout.createParallelGroup(Alignment.LEADING)
        		.addGroup(groupLayout.createSequentialGroup()
        			.addGap(28)
        			.addComponent(panel, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
        			.addGap(18)
        			.addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 89, GroupLayout.PREFERRED_SIZE)
        			.addGap(18)
        			.addComponent(button_2)
        			.addContainerGap(24, Short.MAX_VALUE))
        );
        
        JButton supplierButton = new JButton("Supplier");
        supplierButton.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
        		
        		new Report(supplierQuery, supplierTitle);
        	}
        });
        supplierButton.setFont(new Font("Arial Black", Font.PLAIN, 14));
        
        JButton fireplaceButton = new JButton("Fireplace");
        fireplaceButton.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
        		
        		new Report(fireplaceQuery, fireplaceTitle);
        	}
        });
        fireplaceButton.setToolTipText("");
        fireplaceButton.setFont(new Font("Arial Black", Font.PLAIN, 14));
        GroupLayout gl_panel_1 = new GroupLayout(panel_1);
        gl_panel_1.setHorizontalGroup(
        	gl_panel_1.createParallelGroup(Alignment.LEADING)
        		.addGroup(Alignment.TRAILING, gl_panel_1.createSequentialGroup()
        			.addGap(21)
        			.addComponent(fireplaceButton, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE)
        			.addPreferredGap(ComponentPlacement.RELATED, 89, Short.MAX_VALUE)
        			.addComponent(supplierButton, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE)
        			.addGap(18))
        );
        gl_panel_1.setVerticalGroup(
        	gl_panel_1.createParallelGroup(Alignment.LEADING)
        		.addGroup(gl_panel_1.createSequentialGroup()
        			.addGap(24)
        			.addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)
        				.addComponent(fireplaceButton, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
        				.addComponent(supplierButton, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE))
        			.addContainerGap(25, Short.MAX_VALUE))
        );
        panel_1.setLayout(gl_panel_1);
        
        JLabel titleLabel = new JLabel("Select Report Type");
        titleLabel.setFont(new Font("Tahoma", Font.BOLD, 22));
        GroupLayout gl_panel = new GroupLayout(panel);
        gl_panel.setHorizontalGroup(
        	gl_panel.createParallelGroup(Alignment.LEADING)
        		.addGroup(gl_panel.createSequentialGroup()
        			.addGap(120)
        			.addComponent(titleLabel, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)
        			.addContainerGap(124, Short.MAX_VALUE))
        );
        gl_panel.setVerticalGroup(
        	gl_panel.createParallelGroup(Alignment.LEADING)
        		.addGroup(gl_panel.createSequentialGroup()
        			.addContainerGap()
        			.addComponent(titleLabel, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE)
        			.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panel.setLayout(gl_panel);
        frmSelectReportType.getContentPane().setLayout(groupLayout);
        frmSelectReportType.setVisible(true);  //setting visibility true
   }
}
